package tests;

import java.io.IOException;

public class OopEx1Test {
	public static void main() throws IOException{
		Runtime rt = Runtime.getRuntime();
		//PUT YOUR COMMAND HERE:
		String javaCmd = "java MyFileScript1";
		String schoolSolution = "~oop/for_students/school_solutions/ex1/ex1SchoolSolution";
		String[] configFiles = {"commands2","commands1.txt", "commands2.txt",
		                        "commands3.txt", "commands1", "commands3",
		                        "commands4", "commands5","commandsMOD","asf1",
		                        "asf2","asf3","asf4", "asf5", "asf6","dan1",
		                        "dan2", "dan3", "dan4", "dan5"};
		for(String config : configFiles){
			//copy the copyDirectory to the testDirectory
		    System.out.println();
		    System.out.println("###############################");
		    System.out.println("Testing config: " + config);
		    System.out.println("###############################");
		    System.out.println();
		    
		    rt.exec("rm -R testDirectorySchool/* -f");
		    rt.exec("rm -R testDirectoryOurs/* -f");
		    rt.exec("cp -pR copyDirectory/* testDirectorySchool");
		    rt.exec("cp -pR copyDirectory/* testDirectoryOurs");

		    //run our solution
		    rt.exec(javaCmd + " testDirectoryOurs " + config + " > ourOutput"); 
		    
		    //run school solution
		    rt.exec(schoolSolution + " testDirectorySchool " + config + " > schoolOutput");

		    rt.exec("sed -i s/testDirectoryOurs/testDirectorySchool/g ourOutput");
		    rt.exec("diff ourOutput schoolOutput");
		    rt.exec("rm ourOutput");
		    rt.exec("rm schoolOutput");
		}		
	}
}
/*







for config in configFiles:



*/